//Р С›Р В±РЎР‰Р ВµР С”РЎвЂљ Р СџР С•Р В»Р Вµ
class Field {

  final static int count = 10;  
  private int[][] cells;               
  private int cell_size = 30;            
  private TPoint corn;                      

  public Field (int x, int y) {
    this.cells = new int[count][count];       
    for (int i = 0; i < count; i++) {
      for (int j = 0; j < count; j++) {   
        this.cells[i][j] = 0;
      }
    }
    this.corn = new TPoint(x, y);
  }
  public Field() {
    this.cells = new int[count][count];
  }
  
  public TMatrix getMatrix() {
    TMatrix matrix = new TMatrix(count);
    for (int i = 0; i < count; i++) {
      for (int j = 0; j < count; j++) {
        matrix.setMatrixValue(i, j, cells[i][j]);
      }
    }
    return matrix;
  }
  
  public TMatrix getInvertedMatrix() {
    TMatrix matrix = new TMatrix(count);
    for (int i = 0; i < count; i++) {
      for (int j = 0; j < count; j++) {
        matrix.setMatrixValue(i, j, cells[j][i]);
      }
    }
    return matrix;
  }
  
  public Field (Field f) {
    this.cells = new int [f.getCount()][f.getCount()];
    for (int i = 0; i < count; i++) {
      for (int j = 0; j < count; j++) {   
        this.cells[i][j] = f.getCellValue(i, j);
      }
    }
    this.corn=f.getCorn();
  }

  public TPoint getCorn() {
    return corn;
  }

  public void setCorn(TPoint p) {
    this.corn=p;
  }

  public int getCellSize() {
    return this.cell_size;
  }

  public int getCount() {
    return this.count;
  } 

  public int[][] getCells() {
    return this.cells;
  } 

  public int getCellValue(int aRow, int aCol) {
    if (aRow<0 || aCol<0 || aRow>9 || aCol>9) {
      return -1;
    } 
    else {
      return this.cells[aRow][aCol];
    }
  }

  public void setCellValue(int aRow, int aCol, int value) {
    this.cells[aRow][aCol]=value;
  }
  public void removeNegOne(){
    for (int i = 0; i < count; i++) {
      for (int j = 0; j < count; j++) {  
       if (this.cells[i][j] == -2){ 
        this.cells[i][j] = 0;}
      }
    }
  }
  public void clear() {
    for (int i = 0; i < count; i++) {
      for (int j = 0; j < count; j++) {   
        this.cells[i][j] = 0;
      }
    }
  }
}

